<template>
  <div>
    <div shadow="hover" class="mgb20 userBox" style="height: 273px">
      <div class="user-info">
        <img :src="pic" class="user-avator" alt />
        <div class="user-info-cont">
          <div class="user-info-name">{{ name }}</div>
          <div>{{ role }}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { api } from "@/api/index";
export default {
  name: "dashboard",
  setup() {
    const name = localStorage.getItem("ms_username");
    const role = name === "admin" ? "超级管理员" : "普通用户";
    return { name, role };
  },
  data() {
    return {
      name: localStorage.getItem("ms_username"),
      info: {},
      pic: this.$store.state.adminMsg.agentLogo,
    };
  },
  created() {
  },
  methods: {
    getData() {
      api('/web/home/info', {}).then((res) => {
        if (res.code === 2000) {
          this.info = res.data;
        } else {
          this.$message.error(res.message);
        }
      });
    },
  }
};
</script>

<style scoped lang="scss">
.el-row {
  margin-bottom: 20px;
}

.grid-content {
  display: flex;
  align-items: center;
  height: 100px;
}

.grid-cont-right {
  flex: 1;
  text-align: center;
  font-size: 14px;
  color: #999;
}

.grid-num {
  font-size: 30px;
  font-weight: bold;
}

.grid-con-icon {
  font-size: 50px;
  width: 100px;
  height: 100px;
  text-align: center;
  line-height: 100px;
  color: #fff;
}

.grid-con-1 .grid-con-icon {
  background: rgb(45, 140, 240);
}

.grid-con-1 .grid-num {
  color: rgb(45, 140, 240);
}

.grid-con-2 .grid-con-icon {
  background: rgb(100, 213, 114);
}

.grid-con-2 .grid-num {
  color: rgb(45, 140, 240);
}

.grid-con-3 .grid-con-icon {
  background: rgb(242, 94, 67);
}

.grid-con-3 .grid-num {
  color: rgb(242, 94, 67);
}

.userBox {
  background-color: #fff;
  overflow: hidden;
  color: #303133;
  border-radius: 5px;
}

.user-info {
  padding-bottom: 20px;
  margin-bottom: 20px;
  text-align: center;
  position: relative;
  top: 50%;
  transform: translateY(-50%);
}

.user-avator {
  width: 120px;
  height: 120px;
  border-radius: 50%;
}

.user-info-cont {
  flex: 1;
  font-size: 14px;
  color: #999;
}

.user-info-cont div:first-child {
  font-size: 30px;
  color: #222;
}

.mgb20 {
  margin-bottom: 20px;
}

.todo-item {
  font-size: 14px;
}

.todo-item-del {
  text-decoration: line-through;
  color: #999;
}

.levelList {
  li {
    display: flex;
    justify-content: space-between;
    align-content: center;
    padding: 10px;

    :first-child {
      font-weight: 600;
    }

    :last-child {
      color: rgb(45, 140, 240);
      font-weight: 600;
      font-size: 19px;
    }
  }
}
</style>